# Python 2.6.4
# Project Euler, Problem 42
# Copyright 2010 Talha Zaman

words = open('words.txt').readline().strip('"').split('","')
tri = [n*(n+1)/2 for n in range(27)]
print sum([1 for w in words if (sum([ord(c)-64 for c in w]) in tri)])
#count = 0
#for w in words:
#    if sum([ord(c)-64 for c in w]) in tri: count += 1
#print count
